package com.xujie.sportsmeeting.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 比赛项目VO
 */
@Data
@Schema(description = "比赛项目VO")
public class EventVO {
    
    @Schema(description = "ID")
    private Long id;
    
    @Schema(description = "项目名称")
    private String eventName;
    
    @Schema(description = "项目编码")
    private String eventCode;
    
    @Schema(description = "项目类型")
    private Integer eventType;
    
    @Schema(description = "性别限制")
    private Integer genderLimit;
    
    @Schema(description = "年龄分组")
    private String ageGroup;
    
    @Schema(description = "最大参赛人数")
    private Integer maxParticipants;
    
    @Schema(description = "项目描述")
    private String description;
    
    @Schema(description = "比赛规则")
    private String rules;
    
    @Schema(description = "计分方式")
    private String scoringMethod;
    
    @Schema(description = "成绩单位")
    private String unit;
    
    @Schema(description = "比赛地点")
    private String venue;
    
    @Schema(description = "比赛时间")
    private LocalDateTime competitionTime;
    
    @Schema(description = "比赛时长(分钟)")
    private Integer durationMinutes;
    
    @Schema(description = "报名开始时间")
    private LocalDateTime registrationStartTime;
    
    @Schema(description = "报名结束时间")
    private LocalDateTime registrationEndTime;
    
    @Schema(description = "状态")
    private Integer status;
    
    @Schema(description = "创建时间")
    private LocalDateTime createTime;
    
    @Schema(description = "更新时间")
    private LocalDateTime updateTime;
    
    @Schema(description = "分配的裁判员列表")
    private List<com.xujie.sportsmeeting.entity.Judge> assignedJudges;
    
    /**
     * 获取项目类型文本
     */
    public String getEventTypeText() {
        if (eventType == null) return "-";
        return switch (eventType) {
            case 1 -> "个人项目";
            case 2 -> "团体项目";
            default -> "未知";
        };
    }
    
    /**
     * 获取性别限制文本
     */
    public String getGenderLimitText() {
        if (genderLimit == null) return "-";
        return switch (genderLimit) {
            case 0 -> "不限";
            case 1 -> "男子";
            case 2 -> "女子";
            default -> "未知";
        };
    }
    
    /**
     * 获取状态文本
     */
    public String getStatusText() {
        if (status == null) return "-";
        return switch (status) {
            case 0 -> "禁用";
            case 1 -> "正常";
            case 2 -> "报名中";
            case 3 -> "比赛中";
            case 4 -> "已结束";
            default -> "未知";
        };
    }
}
